init: remove unnecessary stop logic
authorAndris PE <[email protected]>
Mon, 2 Sep 2024 15:38:59 +0000 (15:38 +0000)
committerJo-Philipp Wich <[email protected]>
Mon, 17 Mar 2025 15:44:40 +0000 (16:44 +0100)
Always remove table and service state to have consistent cleaned up
system state on exit even if user intentionally dropped our table.
Removes dependency on grep as a consequence.

Ref: https://wiki.nftables.org/wiki-nftables/index.php/Configuring_tables
Supersedes: https://github.com/openwrt/firewall4/pull/33
Signed-off-by: Andris PE <[email protected]>
root/sbin/fw4

index c3e95c2cc1a42caa6f9b7e71fb0b6d3fa72b8778..d9ac8a19fb6247661b5b8bc73e8c73fb91c6b826 100755 (executable)
@@ -49,12 +49,9 @@ stop() {
        {
                flock -x 1000
 
-               if nft list tables inet | grep -sq "table inet fw4"; then
-                       nft delete table inet fw4
-                       rm -f $STATE
-               else
-                       return 1
-               fi
+               nft delete table inet fw4
+               rm -f $STATE
+
        } 1000>$LOCK
 }